home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fatted Calf
/
The Fatted Calf.iso
/
Applications
/
Communication
/
NewsBase
/
Source
/
common.subproj
/
errdebug.h
< prev
next >
Wrap
Text File
|
1993-01-12
|
1KB
|
54 lines
#ifdef DEBUG
#import <stdio.h>
extern int ck_level;
#define STRDBG(string) STRNDBG(string, sizeof(string))
#ifdef __OBJC__
#import <appkit/Application.h>
int ck_dbg(int, id, SEL);
#define DBG(flag,dbgfunc) \
{if(ck_dbg(flag,self,_cmd)) {\
fprintf(stderr,"DBG%d: \"%s\" %s (%d)\n",flag,\
(char *)[self name],(char *)sel_getName(_cmd),(int)_cmd);\
fprintf(stderr,"DBG%d: ",flag);dbgfunc;\
fprintf(stderr,"\n");\
}}
#define STRNDBG(string, len) \
{if(strlen(string) + 1 > len) {\
fprintf(stderr,"DBG: \"%s\" %s (%d) string overflow\n",\
(char *)[self name],(char *)sel_getName(_cmd),(int)_cmd);\
[NXApp terminate:self];\
}}
#else __OBJC__
#define DBG(flag,dbgfunc) \
{if(flag<=ck_level) {\
fprintf(stderr,"DBG%d: file:%s line:%d\n",flag,\
__FILE__, __LINE__);\
fprintf(stderr,"DBG%d: ",flag);dbgfunc;\
fprintf(stderr,"\n");\
}}
#define STRNDBG(string, len) \
{if(strlen(string) + 1 > len) {\
fprintf(stderr,"DBG: file:%s line:%d string overflow\n",\
__FILE__, __LINE__);\
exit(-1);\
}}
#endif __OBJ__
#else DEBUG
#define DBG(x,x)
#define STRNDBG(x,x)
#define STRDBG(x)
#endif DEBUG